Prime Numbersprime : Prime uses the Sieve of Eratosthenes method to determine the nth prime for relatively small prime numbers, beginning with PRIME(1) = 2. The larger the value of n, the longer the time required to determine the result. Therefore, this function places an upper time limit on the calculation, and returns a range error if the result cannot be determined in this time. This upper limit is configurable, and can be set with the 'Function Timeout' option in the calculator's Options Window. Also, note that this function is not designed to generate huge primes and it will, therefore, return range error if the input value exceeds 20,000,000 (the 20 millionth prime is 373,587,883). Generally, however, a computer with a 2GHz CPU should be able to determine the millionth prime number within around 2 seconds. For example, PRIME(1,000,000) = 15,485,863. You can confirm the results generated by DreamCalc Pro by visiting www.prime-numbers.org. primeQ : PrimeQ uses the Trial by Division method to determine whether the input value is a prime number. If the value is prime, it returns 1, otherwise it returns 0. For example, PRIMEQ(54,781) = 0, as 54871 is divisible by 29. Whereas, PRIMEQ(86,028,121) = 1, as 86,028,121 is prime. This function places an upper time limit on the calculation, and returns a range error if the result cannot be determined in this time. This upper limit is configurable, and can be set with the 'Function Timeout' option in the calculator's Options Window. Note that this function can only work with input values which can be accurately represented within the precision supported. It is, therefore, not possible to test values which require a greater degree of precision. factor : Calculates the smallest positive integer divisor of the input value. For even numbers, this function will always return 2. For prime numbers or non-integer values, it returns a math error. For other values, it will return a prime number divisor. Example, FACTOR(54,781) = 29. To determine the largest divisor, divide the original input by the result of FACTOR, i.e. 54,781 รท FACTOR(54,781) = 1,889. This function places an upper time limit on the calculation, and returns a range error if the result cannot be determined in this time. This upper limit is configurable, and can be set with the 'Function Timeout' option in the calculator's Options Window. Note that this function can only work with input values which can be accurately represented within the precision supported. |
Copyright 2003 - 2004 : Andy Thomason
All Rights Reserved